package net.e4net.watrix.proc.join;

import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;

import net.e4net.watrix.common.tao.TaoDataSet;
import net.e4net.watrix.common.tao.TaoException;
import net.e4net.watrix.common.tao.TaoResult;
import net.e4net.watrix.common.tao.simpleDao.QueryProcess;



@SuppressWarnings("serial")
public class idCheckProc extends QueryProcess{
		
		public String getQuery(){
			
		StringBuffer sb = new StringBuffer();
			sb.append("\nSELECT ID ");
			sb.append("\nFROM MEMBER ");
			sb.append("\nWHERE ID = ?");
				
		return sb.toString();
		}
		
		public TaoResult process(Connection con, TaoDataSet dataset) throws TaoException {
			
			PreparedStatement pstmt = null;
			TaoResult result = null;
			ResultSet rs = null;
			
			
			try{
				int pidx = 0;
				pstmt = con.prepareStatement(getQuery());
				pstmt.setString(++pidx, dataset.getString("ID"));
				
				rs = pstmt.executeQuery();
				
				result = super.getTaoResult(rs);
				
			} catch (Throwable t) {
	            throw new TaoException(processTitle, t);
	        } finally {
	            if (rs != null) try { rs.close(); } catch (SQLException e) {}
	            if (pstmt != null) try { pstmt.close(); } catch (SQLException e) {}
	        }

	        return result;
	    }
	
	

}
